Wide spread of IoT devices has made it possible to acquire enormous amounts of realtime sensor information. Due to the explosive increase in the sensing data volume, it becomes difficult to collect and process all the data in one central place. On one hand, storing and processing data on edge devices, so called edge computing, is becoming important. On the other hand, edge devices usually have only limited computing and memory resources, and hence it is not practical to process and save all the acquired data. There is a great demand of effectively selecting data to process on an edge device or to transfer it to a cloud server. In this paper, we propose an efficient density-based data selection and management method called O-D2M by which edge devices store the data representing inherent data distribution. We use a low cost graph algorithm to analyze input data trend and its density. We evaluate effectiveness of the proposed O-D2M comparing to other methods in terms of the accuracy of machine learning models trained by the selected data. Throughout the evaluation, we confirm that O-D2M obtains higher accuracy and lower computation cost while it can reduce the amount of data to be processed or transferred by up to 20 points.