Cavitation is caused by the sudden collapse of gas bubbles in a liquid if the vapour pressure is exceeded by the surrounding liquid pressure.
Flashing is caused by the generation of vapour bubbles when the vapour pressure of a liquid exceeds the surrounding liquid pressure.