This phase I/II trial studies the side effects and best dose of vorinostat and azacitidine and to see how well they work in treating patients with myelodysplastic syndromes or acute myeloid leukemia. Vorinostat may stop the growth of cancer or abnormal cells by blocking some of the enzymes needed for cell growth. Drugs used in chemotherapy, such as azacitidine, work in different ways to stop the growth of cancer or abnormal cells, either by killing the cells, by stopping them from dividing, or by stopping them from spreading. Giving vorinostat together with azacitidine may kill more cancer or abnormal cells.