We show direct formal relationship between the Wang-Landau iteration [PRL 86, 2050[PRL 86, (2001], metadynamics [PNAS 99, 12562 (2002)] and statistical temperature molecular dynamics (STMD) [PRL 97, 050601 (2006)], the major work-horses for sampling from generalized ensembles. We demonstrate that STMD, itself derived from the Wang-Landau method, can be made indistinguishable from metadynamics. We also show that Gaussian kernels significantly improve the performance of STMD, highlighting the practical benefits of this improved formal understanding.