Laser cooling with electromagnetically induced transparency: application to trapped samples of ions or neutral atoms