If $G$ and $H$ are finite groups of the same cardinality, then any surjective homomorphism $\phi:G\to H$ is bijective, hence an isomorphism. If $H = \langle h_1,\ldots,h_n\rangle$ and each $h_i$ is in the image of $\phi$, then $\phi$ is surjective.
So in your situation, if you can prove that there is a homomorphism $\phi:G\to D_q$ such that $\phi(a)=s$ and $\phi(b)=o$, then indeed $\phi$ is an isomorphism. The question is whether there exists such a homomorphism. There does exist such a homomorphism if and only if $s$ and $o$ satisfy all the same relations together that $a$ and $b$ satisfy. This can be checked using a presentation of $G$.
A presentation of a group $G$ is a set $S$ of generators for $G$, together with a minimal set $R$ of relations on that set of generators. This means that every relation satisfied by the elements of $S$ can be derived from the relations in $R$. We usually write this as $G = \langle S | R \rangle$.
For example, one presentation of the dihedral group of order $2q$ is
$$D_q = \langle \rho,\tau | \rho^q=1, \tau^2=1, (\rho\tau)^2=1\rangle$$ where $\rho$ is a rotation and $\tau$ is a reflection. ($1$ is the identity element.)
So if $\phi:D_q\to H$ is a homomorphism, then we must have
$$\phi(\rho)^q=1, \phi(\tau)^2=1, (\phi(\rho)\phi(\tau))^2=1.$$ The usefulness of a presentation is that these relations are equivalent to $\phi$ defining a homomorphism. That is, if $x$ and $y$ are elements of $H$ such that
$$x^q=1, y^2=1, (xy)^2=1$$ then there exists a unique homomorphism $\phi:D_q\to H$ such that $\phi(\rho)=x$ and $\phi(\tau)=y$. The analogous statement is true for an arbitrary presentation $\langle S|R\rangle$.