Is magnetic dipole moment the same as electric dipole moment? In the problem below, why does the second method used to calculate magnetic dipole moment $\vec {\mu}$ essentially use the definition of the electric dipole moment $\vec {p}$? Is magnetic dipole moment the same as electric dipole moment? Can this method always be used? If yes, what is the need to differentiate between the two?

 A: Electric dipole moment and magnetic dipole moment are not the same quantity, because (of course) an electric dipole moment creates an electric field, while a magnetic dipole moment creates a magnetic field.
However, in the presence of magnetized matter and in the absence of free currents, it is possible to define a (fictitious) "magnetic charge" $\rho_m = -\vec{\nabla} \cdot \vec{M}$.  (On the boundary between media, we can similarly define $\sigma_m = \vec{M} \cdot \hat{n}$.)  The auxiliary field $\vec{H}$ then satisfies $\vec{\nabla} \cdot \vec{H} = \rho_m$ and $\vec{\nabla} \times \vec{H} = 0$, so we can use the same mathematical techniques to find $\vec{H}$ as we do to find the electric field outside a known charge distribution.
In particular, this allows us to define a "Coulomb's Law" for $\vec{H}$, in analogy to that for the electric field:
$$
\vec{H}(\vec{r}) = \frac{1}{4 \pi} \iiint \rho_m(\vec{r}')\frac{\vec{r} - \vec{r}'}{|\vec{r} - \vec{r}'|^3} \, d^3\vec{r}'.
$$
One can then perform a multipole expansion for this $\vec{H}$ in powers of $r^{-1}$;  and the "dipole term" for this expansion is defined in terms of $\rho_m$ in exactly the same way that $\vec{p}$ is related to $\rho$.
For more information on this technique, I recommend Zangwill's Modern Electrodynamics, as well as my answers here and here.  Or, perhaps, "Slide 5" from your instructor's notes.
