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