Induced Sheaf Structure is equivalent to Inverse Image Sheaf?

Let $f:X \rightarrow Y$ be a map and let $Y$ be a ringed space, i.e. we have a sheaf of rings $O_Y$. Suppose that the regular functions are $k$-valued functions, where $k$ is a field. Define the open sets of $X$ to be generated by inverse images of open sets of $Y$. We want to give $X$ a ringed space structure. One way is to consider the inverse image sheaf. Another way is to define a function $g$ on $U$ to be regular, where $U$ is open in $X$, whenever there exists a covering $U \subseteq \cup_{a} f^{-1}(V_a)$ and regular functions of $Y$, $g_a : V_a \rightarrow k$, such that $g|_{U \cap f^{-1}(V_a)} = (g_a \circ f)|_{U \cap f^{-1}(V_a)}, \, \forall a$. Are the two constructions equivalent?

-
You shouldn't think of sections of the structure sheaf as regular "functions" with some specified codomain – in scheme theory, for example, this fails. –  Zhen Lin Sep 25 '12 at 5:04