We assume that $ \mathcal{A}_{M} $ and $ \mathcal{A}_{N} $ are maximal $ C^{\infty} $-atlases on $ M $ and $ N $ respectively. The proof of sufficiency then proceeds as follows.
The chart maps coming from $ \mathcal{A}_{M} $ and $ \mathcal{A}_{N} $ are automatically diffeomorphisms (to prove this, use the fact that transition functions are smooth by definition). Hence, $ y: U \rightarrow y[U] $ and $ y \circ f: {f^{-1}}[U] \rightarrow y[U] $ are both diffeomorphisms. It thus follows that both $ f|_{{f^{-1}}[U]} = y^{-1} \circ (y \circ f): {f^{-1}}[U] \rightarrow U $ and $ f^{-1}|_{U} = (y \circ f)^{-1} \circ y: U \rightarrow {f^{-1}}[U] $ are diffeomorphisms, hence smooth functions.
Observe that $ \{ {f^{-1}}[U] \,|\, (U,y) \in \mathcal{A}_{N} \} $ is an open cover of $ M $ and that $ f $ is smooth on each piece of the cover. Hence, by the smooth version of the Pasting Lemma, $ f $ is smooth globally.
Likewise, $ \{ U \,|\, (U,y) \in \mathcal{A}_{N} \} $ is an open cover of $ N $ and $ f^{-1}|_{U} $ is smooth on each piece of the cover. Hence, $ f^{-1} $ is smooth globally.
We therefore conclude that $ f: M \rightarrow N $ is a diffeomorphism.