$\DeclareMathOperator\Hom{Hom}$
Yes, this is true, and the proof is elementary: let us write $\Omega(A):=\Hom(A,\mathbb{C})$ for the space of characters of $A$, viewed as a subspace of the unit ball of the dual $A^*$, and endowed with the weak*-topology (i.e., the topology of pointwise convergence). This is a compact Hausdorff space if $A$ is a unital $C^*$-algebra (in general it is locally compact Hausdorff, if $A$ is not unital).
We claim that there exists a natural bijection
$$\Hom(A,C(S))\cong \Hom(S,\Omega(A)),$$
where the left hom-set is in the category of unital $C^*$-algebras with unital $*$-homomorphisms, and the right hom-set is in the category of compact Hausdorff spaces.
Given $f\in \Hom(A,C(S))$, we define $\tilde f\in \Hom(S,\Omega(A))$ by $\tilde f(s)(a):=f(a)(s)$ for all $s\in S$, $a\in A$. It is clear that
$$\Hom(A,C(S))\ni f\mapsto \tilde f\in \Hom(S,\Omega(A))$$
is a well-defined injective map. To see that it is surjective, take $g\in \Hom(S,\Omega(A))$ and define $f(a)(s):=g(s)(a)$. Then $\tilde f=g$, so that the map above is also a surjection, therefore a bijection, as desired.