Environmental and dynamical effects on the optical properties of molecular systems by time-independent and time-dependent approaches: Coumarin derivatives as test cases