You certainly can’t do it in general if $X$ isn’t a sequential space, i.e., one whose structure is completely determined by its convergent sequences. $X$ is sequential iff it’s the quotient of a metric space, and the composition of two quotient maps is a quotient map, so if $X$ is sequential, $Y$ is also sequential, therefore $f$ is continuous iff $\lim\limits_n\;f(y_n) = f(\lim\limits_n\;y_n)$ for every convergent sequence $\langle y_n:n\in\omega\rangle$ in $Y$.
However, you can’t always pull this back to $X$.
Edit (24 April 2016): Take $X=[0,1]$, and let $Y$ be the quotient obtained by identifying $0$ and $1$ to a point $p$, $g$ being the quotient map. Suppose that $f:Y\to Z$, and you want to test the continuity of $f$. For $n\in\mathbb{Z}^+$ let
$x_n=\begin{cases} \frac2{n+4},&\text{if }n\text{ is even}\\ \frac{n+1}{n+3},&\text{if }n\text{ is odd}\;, \end{cases}$
so that
$\langle x_n:n\in\Bbb Z^+\rangle=\left\langle\frac12,\frac13,\frac23,\frac14,\frac34,\frac15,\frac45,\ldots\right\rangle\;.$
Then $\langle g(x_n):n\in\mathbb{Z}^+\rangle$ converges to $p$ in $Y$, so you need to test whether $\langle f(g(x_n)):n\in\mathbb{Z}^+\rangle$ converges to $f(p)$ in $Z$, but you can’t do this by asking whether $\lim_n\;f(g(x_n))=f(g(\lim_n\;x_n))\;,$ because $\langle x_n:n\in\mathbb{Z}^+\rangle$ isn’t convergent in $X$. Thus, the answer to your first question is no even if $X$ is metric.
(This replaces a flawed example with one that actually works, borrowed from this answer by Eric Wofsey.)
End edit.
The answer to your second question, however, is yes. Let $\langle y_n:n\in\omega\rangle$ be a convergent sequence in $Y$ with limit $y$. Then there are $x_n\in X$ such that $y_n = g(x_n)$ for $n\in\omega$, so checking that $\lim_n\;f(y_n)=f(y)$ is checking that $\lim_n\;f(g(x_n))=f(\lim_n\;g(x_n))\;.$ Note, though, that you have to check all sequences in $X$, not just convergent ones.