Planck intermediate results. XXXII. The relative orientation between the magnetic field and structures traced by interstellar dust