It is a dilemma to balance the tradeoff between the computation efficiency and communication cost of deploying deep learning models in the mobile edge computing (MEC) systems, due to the isolation of collected data and computation capability. To solve this problem, a hybrid federated and centralized learning scheme is first proposed in this paper, where the learning model can be jointly generated based on the centralized learning model and the federated learning model. It can make full use of both the collected data of user terminals and power full computation capability of edge computing servers. Second, to guarantee the model accuracy with communication, computation, and data constraints, an optimization algorithm is designed to keep a sophisticated tradeoff of model accuracy and training cost. Finally, the experiment results base on the image data set are provided, which show that our proposed algorithm can significantly improve the model accuracy with low costs.