The potential energy of a dipole in an electric field is expressed as:
\[
U = - \mathbf{p} \cdot \mathbf{E} = - pE \cos \theta
\]
The dipole is initially aligned with the field, meaning \(\theta = 0^\circ\), resulting in an initial energy:
\[
U_i = - pE
\]
When the dipole is reversed to be opposite the field (\(\theta = 180^\circ\)), the final energy is:
\[
U_f = pE
\]
The work needed for this rotation is calculated as:
\[
W = U_f - U_i = pE - (-pE) = 2pE
\]
With the provided values, the work is:
\[
W = 2 \times (6 \times 10^{-6}) \times (10^6)
\]
\[
W = 12 \times 10^{-3} = 6 \times 10^{-3} { J}
\]