The one on top is a special capacitor for the input filtering circuits of the mains voltage.
It is specially designed so that if it fails, it does not lead to dangerous consequences. For example, to a fire.
The lower capacitor will do the job no worse than the upper one (if you were not mistaken that it is 2 kilovolts).
But if there are no X1/X2/Y1/Y2, marks on it, then theoretically it may not be safe in case of breakdown (due to high-voltage surges). In practice, however, it is a fairly safe element. The main thing is not to put ordinary capacitors instead of Y-capacitors, since they can be connected to the device case.
And it's strange that you are trying to swap this capacitor. Usually they stand at the inlet of the device as filtering devices, and never require attention to themselves.