The driving mechanism of solar flares and coronal mass ejections is a topic of ongoing debate, apart from the consensus that magnetic reconnection plays a key role during the impulsive process. While present solar research mostly depends on observations and theoretical models, laboratory experiments based on high-energy density facilities provide the third method for quantitatively comparing astrophysical observations and models with data achieved in experimental settings. In this article, we show laboratory modeling of solar flares and coronal mass ejections by constructing the magnetic reconnection system with two mutually approaching laser-produced plasmas circumfused of self-generated megagauss magnetic fields. Due to the Euler similarity between the laboratory and solar plasma systems, the present experiments demonstrate the morphological reproduction of flares and coronal mass ejections in solar observations in a scaled sense, and confirm the theory and model predictions about the current-sheet-born anomalous plasmoid as the initial stage of coronal mass ejections, and the behavior of moving-away plasmoid stretching the primary reconnected field lines into a secondary current sheet conjoined with two bright ridges identified as solar flares.