Trait-mediated effects of environmental filtering on tree community dynamics