This phase I/II trial is studying the side effects and best dose of azacitidine when given together with entinostat and to see how well they work in treating patients with recurrent advanced non-small cell lung cancer. Azacitidine and entinostat may stop the growth of tumor cells by blocking some of the enzymes needed for cell growth. Giving azacitidine together with entinostat may kill more tumor cells.