I've done this often, and have developed a method I like and feel comfortable with....
Adhesives like PL-200 or Liquid Nails is ok, but at a later date may decide to move a bit, particularly if there is any kind of lateral pressure and/or it didn't bond well with the concrete floor in the first place.
Explosive charge driven concrete nails is very fast and convenient, but they are expensive, and if the concrete is older (and hard/brittle), the nails may shoot out almost horizontally, often causing big 'divots' out of the concrete floor. Also, after the fact adjustments for mistakes are very difficult or impossible without breaking chunks out of the floor
My preferred method is to drill 1/4" holes with a roto-hammer and use simple 1/4" plastic anchors screwed into with simple drywall screws through the 2X4. It is easy to correct later mistakes, the anchors and screws are relatively inexpensive and they are quite strong. The only drawback is roto-hammers (my preference is the 1" SDS hammer made by DeWalt or Bosch) are a bit pricey (about $200), but on the other hand, it is a tool you will use over and over again in the future.
Also, because the 2X4 is in contact with concrete, be sure to use a pressure treated or redwood 2X4.