Criterion for Bose-Einstein condensation in traps and self-bound systems