The fault tree analysis (FTA) and the failure mode effects analysis (FMEA) are widely applied to the safety evaluation of a system, especially in the development of large-scale and mission-critical system such as nuclear power plants, aircrafts, and space rockets. The principle of FTA and FMEA is to trace comprehensively cause-effect relations among anomaly causes and undesirable effects. Their results are summarized as trees and tables for the sake of tractability in safety evaluation. The Multi-level Flow Modeling (MFM) is a functional modeling technique. It models diagrammatically a system from the viewpoint of the means-end dimension. This paper proposes a technique to automatically generate FTA trees and FMEA table from causal relations among functions and sub-goals of a system that is expressed in the MFM model of the system with the additional ontology of device anomaly. The applicability and the effects of the technique have been confirmed through the development of a fuel injection system of a launcher for a middle-size space rocket.