Message passing and Monte Carlo algorithms: Connecting fixed points with metastable states