If X is a scheme, we know there is a one-one correspondence between quasi-coherent sheaves of $\mathcal O_X$-algebras on X and affine morphisms $Y \longrightarrow X$

But what about arbitrary (not necessarily quasi-coherent) sheaves of $\mathcal O_X$-algebras? Do they correspond to schemes $Y\longrightarrow X$?

It seems to me that given a morphism $f:Y\longrightarrow X$ of schemes, for any $U\subseteq X$, the association $U\mapsto \mathcal O_Y(f^{-1}(U))$ defines a sheaf of $\mathcal O_X$-algebras. That's one direction. Does it not work in the other direction for some reason?