Predicting ecosystem stability from community composition and biodiversity