The voltage across an ideal capacitor (ideal in that it is pure capacitance, it has no internal series resistance) cannot undergo a step change instantaneously. The current through a capacitor, on the other hand, can be changed instantaneously. The voltage across the capacitor changes "gradually" as current flows through it to charge it to a higher voltage or discharge it to a lower voltage depending on which direction the current is flowing. This is why, if you short the terminals of a charged capacitor, you will see a spark. The energy stored in the capacitor dissipates quickly in molten metal at the point of contact and in other resistances in the circuit. If there was no internal series resistance of a real capacitor, the current would tend to be infinite. In a real capacitor the current is limited by this resistance.
Conversely, the current through an inductor cannot undergo a step change instantaneously. That would require infinite voltage. Unlike the capacitor, the voltage across an inductor can be changed instantaneously. The current through the inductor changes "gradually" as voltage is applied across it. When current is flowing through an inductor, it will continue to flow when the circuit is broken. This is why you see a spark across the contacts of a switch when you try to interrupt the circuit by opening the switch. The energy stored in the magnetic field of the inductor must be dissipated or transferred from the inductor. Thus, as the switch opens, the voltage rises sharply causing the air in the gap of the contacts to ionize and become conductive enough for the current to keep flowing. The energy quickly dissipates in the resulting spark.
The kinetic energy stored in an inductor can be transferred to potential energy in a capacitor by connecting a capacitor across the terminals of the above switch. The current through the inductor will flow through the capacitor, raising the voltage of the capacitor from zero while reducing the current towards zero. Eventually the current will reverse and the voltage will fall, transferring the energy back into the inductor. This sloshing back and forth between the two will continue until it eventually gets dissipated in the unavoidable parasitic resistance of the elements in the circuit.
I like to think of a capacitor as the compliance of a mechanical spring. And an inductor as the mass of an object. A moving mass connected to a spring has a similar result. The speed of the mass (like current) will compress the spring causing the force (like voltage) to rise until the motion stops and all the kinetic energy of the mass has been converted into potential energy in the spring. Then the process reverses and the energy transfers back into the mass. The mass oscillates back and forth, much the way the voltage oscillates in a resonant electrical circuit.