Object A make Object B expand on ingoing and then shrink on outgoing
As Vklidu says you can use the Cast modifier, you can also use the Lattice modifier:
Create a lattice, scale it in Object mode so that it can contain the cube object that it is supposed to deform, put it at the same position as the bullet, parent it to the bullet, give your lattice a bit of Resolution in the Object Data panel, modify it in Edit mode so that it has the deforming shape you want, give your cube object a Lattice modifier with the lattice as lattice Object:

Now when you move your bullet the lattice follows and deforms the cube: