On the relationship between the algebraic connectivity and graph's robustness to node and link failures