Unified Relationship between Cold Plasma Ejections and Flare Energies Ranging from Solar Microflares to Giant Stellar Flares