Let us consider, the force on either charge be;-
we know, the magnitude of torque is given as ;
either force
perpendicular distance between them
therefore,
Such that, (From the definition of dipole moment)
The torque is the cross product of dipole moment and electric field