Three-dimensional magnetohydrodynamic simulations on the interaction of interplanetary density pulses with the bow shock