Poincaré and logarithmic Sobolev constants for metastable Markov chains via capacitary inequalities