  Core-collapse supernovae (SNe) are the inevitable fate of most massive stars.
Since most stars form in groups, SN progenitors can be constrained with
information of their environments. It remains challenging to accurately analyse
the various components in the environment and to correctly identify their
relationships with the SN progenitors. Using a combined dataset of VLT/MUSE
spatially-resolved integral-field-unit (IFU) spectroscopy and HST/ACS+WFC3
high-spatial resolution imaging, we present a detailed investigation of the
environment of the Type II-P SN 2004dg and Type IIb SN 2012P. The two SNe
occurred in a spiral arm of NGC 5806, where a star-forming complex is apparent
with a giant H II region. By modelling the ionised gas, a compact star cluster
and the resolved stars, we derive the ages and extinctions of stellar
populations in the vicinity of the SNe. The various components are consistent
with a sequence of triggered star formation as the spiral density wave swept
through their positions. For SNe 2004dg and 2012P, we identify their host
stellar populations and derive initial masses of $10.0^{+0.3}_{-0.2}~M_\odot$
and $15.2^{+2.0}_{-1.0}~M_\odot$ for their progenitors, respectively. Both
results are consistent with those from pre-explosion images or nebular-phase
spectroscopy. SN 2012P is spatially coincident but less likely to be coeval
with the star-forming complex. As in this case, star formation bursts on small
scales may appear correlated if they are controlled by any physical processes
on larger scales; this may lead to a high probability of chance alignment
between older SN progenitors and younger stellar populations.
